﻿using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Linq.Expressions;

namespace AstoriaPlus
{
	public class ExtendedDataServiceConfiguration<TDataService, TDataSource>
		where TDataService : DataService<TDataSource>
		where TDataSource : class
	{
		private readonly IList<IEntityInterceptorFactory<TDataService, TDataSource>> changeInterceptors = new List<IEntityInterceptorFactory<TDataService, TDataSource>>();
		private readonly IDictionary<Type, Expression> queryInterceptors = new Dictionary<Type, Expression>();

		public ExtendedDataServiceConfiguration(IDataServiceConfiguration configuration)
		{
			this.Configuration = configuration;
		}

		public IDataServiceConfiguration Configuration { get; private set; }

		public IList<IEntityInterceptorFactory<TDataService, TDataSource>> ChangeInterceptors
		{
			get { return this.changeInterceptors; }
		}

		public IDictionary<Type, Expression> QueryInterceptors
		{
			get { return this.queryInterceptors; }
		}
	}
}
